﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="fhdb" content="true">
    <title>百瑞花苑-用户登录</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/css/bootstrap.min.css">
    <link rel="stylesheet" href="css\style.css?v=2020">
    <link rel="stylesheet" href="css\bootstrapValidator.css">
    <script type="text/javascript" src="jquery\jquery-1.10.2.min.js"></script>
    <script src="jquery\jquery.form.min.js" type="text/javascript"></script>
    <script type="text/javascript" src="jquery\bootstrap.min.js"></script>
    <script type="text/javascript" src="jquery\bootstrapValidator.js"></script>

</head>
<body>
    <div class="phoneError"></div>
    <form id="defaultForm">
        <div class="loginTopTit">
            <img src="images\ziti.png" style="width:100%; height:65%; margin-left:22%; margin-top:-5%;">
        </div>
    <div class="loginBigBox">
        <div class="passBox form-group">
            <span class="glyphicon glyphicon-phone"></span>
            <input type="text" name="phone" placeholder="请输入手机号码">
        </div>
        <div class="passBox form-group">
            <span class="glyphicon glyphicon-lock"></span>
            <input type="password" name="password" placeholder="请确入密码">
        </div>
        <div class="form-group">
            <button type="submit" class="btn btnBox" id="btnBox">
                提交</button>
        </div>
        <div class="logBottomBox">
            <div class="forgotPass">
                <a href="forgotpw.html">忘记密码</a></div>
            <div class="line">
                |</div>
            <div class="uesrRegister">
                <a href="regis.html">用户注册</a></div>
        </div>
    </div>
    </form>
    <script type="text/javascript">
        $(document).ready(function () {
            $.ajax({
                type: "post",
                url: "../../BaseRefWeb.aspx?stype=ISpMemberFun&method=GetDeleteSession&type=sp",
                success: function (result) {
                    
                }
            });
            $('#defaultForm').bootstrapValidator({
                fields: {
                    phone: {
                        validators: {
                            notEmpty: {
                                message: '手机号码不能为空'
                            }
                        }
                    },
                    password: {
                        validators: {
                            notEmpty: {
                                message: '密码不能为空'
                            }
                        }
                    }
                }
            });
        });
        //提交表单数据
        $('#btnBox').click(function (event) {
            /* Act on the event */
            /*手动验证表单，当是普通按钮时。*/
            $('#defaultForm').data('bootstrapValidator').validate(); //启用验证
            var flag = $('#defaultForm').data('bootstrapValidator').isValid()//验证是否通过true/false
            if (flag) {
                $("#defaultForm").ajaxSubmit({
                    type: "post",
                    url: "../../BaseRefWeb.aspx?stype=ISpMemberFun&method=GetLoginUser&type=sp",
                    dataType: "json",
                    success: function (result) {
                        if (result.success == false) {
                            $('.phoneError').text(result.msg);
                            var top = ($(window).height() - $('.phoneError').height()) / 2;
                            var left = ($(window).width() - $('.phoneError').width()) / 2;
                            var scrollTop = $(document).scrollTop();
                            var scrollLeft = $(document).scrollLeft();
                            $('.phoneError').css({ position: 'absolute', 'top': top + scrollTop, left: left + scrollLeft }).show();
                            setTimeout(function () {
                                $('.phoneError').hide();
                                location.reload();
                            }, 1000)
                        }
                        else {
                            window.location.href = "../../rushBuy.html";
                        }
                    }
                });
            }
        });
    </script>
</body>
</html>
